<!-- views/student/Home.vue -->
<template>
  <el-container class="student-container">
    <!-- 顶部导航栏 -->
    <el-header class="header">
      <div class="header-left">
        <h1>黔南民族师范学院计信学院学生去向登记系统</h1>
      </div>
      <div class="header-right">
        <span class="user-info">欢迎，{{ $userStore.name }}-同学</span>
        <el-button size="small" @click="logout">退出</el-button>
      </div>
    </el-header>

    <el-container>
      <!-- 左侧菜单 -->
      <el-aside width="200px" class="sidebar">
        <el-menu
            :default-active="activeMenu"
            background-color="#304156"
            text-color="#bfcbd9"
            active-text-color="#409EFF"
        >
          <el-menu-item index="1" @click="$router.push('/student/travel')">
            <el-icon><Calendar /></el-icon>
            <span>假期去向查询</span>
          </el-menu-item>

          <el-menu-item index="2" @click="$router.push('/student/record')">
            <el-icon><Document /></el-icon>
            <span>登记记录查询</span>
          </el-menu-item>

          <el-menu-item index="3" @click="$router.push('/student/profile')">
            <el-icon><User /></el-icon>
            <span>个人信息</span>
          </el-menu-item>
        </el-menu>
      </el-aside>

      <!-- 右侧内容区 -->
      <el-main class="main-content">
        <router-view />
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
export default {
  data() {
    return {
      activeMenu: '1'
    };
  },
  methods: {
    /**
     * 退出登录
     */
    logout() {
      this.$confirm('确定要退出登录吗？', '退出系统', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        $userStore.logout();
        this.$router.push('/login');
      });
    }
  }
};
</script>
